<%@page import="com.charlie.beans.Roles"%>
<%@page import="java.util.List"%>

<%!
    public String getParameter(HttpServletRequest request, String name) {
        String value = request.getParameter(name);
        if (value == null) {
            return "";
        }
        return value;
    }
%>

<%@include file="/header.jsp" %>

<script type="text/javascript" src="/resources/js/signup.js"></script>
<% if (request.getAttribute("validate") != null) {%>
<script type="text/javascript">
    $(function() {
        email_exist = "${email_exist}";
        $("form").validationEngine('validate');
    });
</script>
<% }%>

<div class="left_side">
    <jsp:include page="/blocks/conditionalLeftBar.jsp" />
</div>

<div class="right_side">
    <h2 class="content_title" style="font-size: x-large;">Create group</h2>
    <div class="white_block"> 
        <h2  class="content_title_black">Information about group</h2>   <p>
        <form method="post">  
            Group name: <p>
            <input type="text" name="groupName" class="validate[required,minSize[1],maxSize[32]]" size="90%" value="<%= getParameter(request, "groupName")%>"><p>
                User's role: <p>
            <table class="typycal_table">
                <tr>
                    <%
                        List<Roles> roles = (List<Roles>) request.getAttribute("roles");
                    %>
                <span class="checkRole">            
                    <%
                        if (roles != null)
                            for (Roles r : roles) {
                                if (!r.getRolesName().equals("Admin")) {
                    %>
                    <td>
                        <input type="checkbox" name="id" value="<%=r.getRolesName()%>"><%=r.getRolesName()%></label>
                    </td>
                    <%}
                        }%>
                </span>
                <td><br><input style="float: right;" type="submit" size="40" value="Create"><p></td>
                </tr>
            </table>
        </form>
    </div>
</div>

<%@include file="/footer.jsp" %>